import { ref } from "vue";

export const useOnWheelHook = () => {
  const wheelScale = ref(1.0);

  const onWheel = event => {
    event.preventDefault();
    if (event.deltaY < 0) {
      wheelScale.value = wheelScale.value + 0.1;
    } else {
      wheelScale.value = wheelScale.value - 0.1;
    }
    // 限制缩放比例范围
    wheelScale.value = Math.min(Math.max(wheelScale.value, 0.1), 2.0);
  };

  return {
    wheelScale,
    onWheel
  };
};
